.TH "servo.h" 3 "Wed Sep 16 2015" "Doxygen" \" -*- nroff -*-
.ad l
.nh
.SH NAME
servo.h \- 
.SH SYNOPSIS
.br
.PP
\fC#include 'ch\&.h'\fP
.br
\fC#include 'hal\&.h'\fP
.br
\fC#include 'hw\&.h'\fP
.br
\fC#include 'conf_general\&.h'\fP
.br
\fC#include 'stm32f4xx_conf\&.h'\fP
.br

.SS "Data Structures"

.in +1c
.ti -1c
.RI "struct \fBSERVO\fP"
.br
.in -1c
.SS "Macros"

.in +1c
.ti -1c
.RI "#define \fB_BV\fP(bit)   (1 << (bit))"
.br
.ti -1c
.RI "#define \fBMIN\fP(a,  b)   (((a)<(b))?(a):(b))"
.br
.ti -1c
.RI "#define \fBMAX\fP(a,  b)   (((a)>(b))?(a):(b))"
.br
.ti -1c
.RI "#define \fBSERVOS_NUM\fP   \fBHW_SERVO_NUM\fP"
.br
.ti -1c
.RI "#define \fBSERVO_CNT_SPEED\fP   1000000L"
.br
.ti -1c
.RI "#define \fBS_STARTPULSE\fP   \fBSERVO_OUT_PULSE_MIN_US\fP"
.br
.ti -1c
.RI "#define \fBS_PULSELEN\fP   (\fBSERVO_OUT_PULSE_MAX_US\fP \- \fBSERVO_OUT_PULSE_MIN_US\fP)"
.br
.ti -1c
.RI "#define \fBS_COOLDOWN\fP   (1000000 / \fBSERVO_OUT_RATE_HZ\fP)"
.br
.ti -1c
.RI "#define \fBSERVO_START_OFFSET\fP   (\fBSERVO_CNT_SPEED\fP / (1000000L / S_STARTPULSE))"
.br
.ti -1c
.RI "#define \fBSERVO_CPU_FACTOR\fP   ((\fBSERVO_CNT_SPEED\fP + ((1000000L / S_PULSELEN) * 256L) \- 1L) / ((1000000L / S_PULSELEN) * 256L))"
.br
.ti -1c
.RI "#define \fBSERVO_COOLDOWN_FACTOR\fP   (\fBSERVO_CNT_SPEED\fP / (1000000L / S_COOLDOWN))"
.br
.ti -1c
.RI "#define \fBUSE_COMMANDS\fP   0"
.br
.ti -1c
.RI "#define \fBTEST_CYCLE_TIME\fP   0"
.br
.ti -1c
.RI "#define \fBACTUAL_POS\fP(servo)   (\fBMAX\fP(\fBMIN\fP(servo\&.pos + (signed short)servo\&.offset, 255), 0))"
.br
.ti -1c
.RI "#define \fBACTUAL_POS_PTR\fP(servo)   (\fBMAX\fP(\fBMIN\fP(servo\->pos + (signed short)servo\->offset, 255), 0))"
.br
.ti -1c
.RI "#define \fBCMD_MS_TO_VAL\fP(ms)   ((ms) / (((\fBS_STARTPULSE\fP + \fBS_PULSELEN\fP + \fBS_COOLDOWN\fP) * CMD_WAIT_FACTOR) / 1000))"
.br
.ti -1c
.RI "#define \fBSERVO_PERIOD_TIME_MS\fP   ((\fBS_STARTPULSE\fP + \fBS_PULSELEN\fP + \fBS_COOLDOWN\fP) / 1000)"
.br
.in -1c
.SS "Functions"

.in +1c
.ti -1c
.RI "void \fBservo_init\fP (void)"
.br
.ti -1c
.RI "void \fBservo_stop_driver\fP (void)"
.br
.ti -1c
.RI "unsigned char \fBservo_driver_is_active\fP (void)"
.br
.ti -1c
.RI "void \fBservo_irq\fP (void)"
.br
.in -1c
.SS "Variables"

.in +1c
.ti -1c
.RI "volatile \fBSERVO\fP \fBservos\fP [\fBSERVOS_NUM\fP]"
.br
.in -1c
.SH "Macro Definition Documentation"
.PP 
.SS "#define _BV(bit)   (1 << (bit))"

.SS "#define ACTUAL_POS(servo)   (\fBMAX\fP(\fBMIN\fP(servo\&.pos + (signed short)servo\&.offset, 255), 0))"

.SS "#define ACTUAL_POS_PTR(servo)   (\fBMAX\fP(\fBMIN\fP(servo\->pos + (signed short)servo\->offset, 255), 0))"

.SS "#define CMD_MS_TO_VAL(ms)   ((ms) / (((\fBS_STARTPULSE\fP + \fBS_PULSELEN\fP + \fBS_COOLDOWN\fP) * CMD_WAIT_FACTOR) / 1000))"

.SS "#define MAX(a, b)   (((a)>(b))?(a):(b))"

.SS "#define MIN(a, b)   (((a)<(b))?(a):(b))"

.SS "#define S_COOLDOWN   (1000000 / \fBSERVO_OUT_RATE_HZ\fP)"

.SS "#define S_PULSELEN   (\fBSERVO_OUT_PULSE_MAX_US\fP \- \fBSERVO_OUT_PULSE_MIN_US\fP)"

.SS "#define S_STARTPULSE   \fBSERVO_OUT_PULSE_MIN_US\fP"

.SS "#define SERVO_CNT_SPEED   1000000L"

.SS "#define SERVO_COOLDOWN_FACTOR   (\fBSERVO_CNT_SPEED\fP / (1000000L / S_COOLDOWN))"

.SS "#define SERVO_CPU_FACTOR   ((\fBSERVO_CNT_SPEED\fP + ((1000000L / S_PULSELEN) * 256L) \- 1L) / ((1000000L / S_PULSELEN) * 256L))"

.SS "#define SERVO_PERIOD_TIME_MS   ((\fBS_STARTPULSE\fP + \fBS_PULSELEN\fP + \fBS_COOLDOWN\fP) / 1000)"

.SS "#define SERVO_START_OFFSET   (\fBSERVO_CNT_SPEED\fP / (1000000L / S_STARTPULSE))"

.SS "#define SERVOS_NUM   \fBHW_SERVO_NUM\fP"

.SS "#define TEST_CYCLE_TIME   0"

.SS "#define USE_COMMANDS   0"

.SH "Function Documentation"
.PP 
.SS "unsigned char servo_driver_is_active (void)"

.SS "void servo_init (void)"

.SS "void servo_irq (void)"

.SS "void servo_stop_driver (void)"

.SH "Variable Documentation"
.PP 
.SS "volatile \fBSERVO\fP servos[\fBSERVOS_NUM\fP]"

.SH "Author"
.PP 
Generated automatically by Doxygen from the source code\&.
